<!DOCTYPE <!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>JStest</title>
</head>

<body>

    <h1>JS Test</h1>

    <p>
        JavaScript 能够直接写入 HTML 输出流中：
    </p>

    <script>
        document.write("<h1>大标题</h1>");
        document.write("<p>段落。</p>");
        document.write("<p>----------------------------------------------------</p>");
    </script>
    <noscript>抱歉，你的浏览器不支持 JavaScript!</noscript>

    <h1>JS Test2</h1>
    <p id="demo">点击按钮能够改变内容</p>

    <script>
        function myFunction1() {
            document.getElementById("demo").innerHTML = "Hello JavaScript!";
        }
    </script>

    <button type="button" onclick="myFunction1()">向 HTML 插入内容</button>

    <script>
        function myFunction2() {
            x = document.getElementById("demo") // 找到元素
            x.style.color = "#00ff00";          // 改变样式
        }
    </script>
    <button type="button" onclick="myFunction2()">改变颜色</button>

</body>

</html>